﻿@using X.PagedList;
@using X.PagedList.Mvc.Core;
@using FwProject.PrePaymentInfo.Dto
@using  FwProject.PrePaymentInfo;
@using X.PagedList.Mvc.Common;
@model IPagedList<ReceiptInfoDto>
@{
    Layout = null;
    int i = 0;
    if (Model.Count > 0)
    {
        if (Model.PageNumber != 1)
        {

            i = (Model.PageNumber - 1) * Model.PageSize;
        }
    }
    decimal SumActualAmount = 0;
    decimal SumWholeAmount = 0;
    decimal SumUsePrePayment = 0;
    decimal SumTaskBackAmount = 0;
    decimal SumPreferentialAmount = 0;
}
<div id="table_print" style="max-height:600px;overflow-y:scroll;">

    <table class="table table-bordered table-hover table-rowselected">
        <thead>
            <tr>
                <th style="width:45px;">序号</th>
                <th>状态</th>
                <th>收款日期</th>
                <th>单号</th>
                <th>收款经办人</th>
                <th>缴款日期</th>
                <th>缴款经办人</th>
                <th>餐厅名称</th>
                <th>账户</th>
                <th>整单金额</th>
                <th>应收金额</th>
                <th>收款金额</th>
                <th>使用预收款金额</th>
                <th>收款优惠</th>
                <th>折扣率</th>
            </tr>
        </thead>
        <tbody>
            @if (Model.Count == 0)
            {
                <tr><td colspan="15" align="center">暂无数据</td></tr>
            }
            else
            {
                foreach (var item in Model)
                {
                    SumActualAmount += item.ActualAmount;
                    SumWholeAmount += item.WholeAmount;
                    SumTaskBackAmount += item.TaskBackAmount;
                    SumUsePrePayment += item.UsePrePayment;
                    SumPreferentialAmount += item.PreferentialAmount;

                    i++;
                    <tr>
                        <td>@i</td>
                        <td>@item.ReceiptInfoStatus</td>
                        <td>@item.Dateofreceipt</td>
                        <td><a href="javascript:top.window.openTab(1455,'收款单[@item.ReceiptInfoNumber]','/Receipt/ReceiptDetail?id=@item.Id')">@item.ReceiptInfoNumber</a></td>
                        <td>@item.AgentPeoper</td>
                        <td>@item.DateofPayment</td>
                        <td>@item.PaymentPerson</td>
                        <td>@item.RestaurantName</td>
                        <td>@item.AccountName</td>
                        <td>@item.WholeAmount</td>
                        <td>@item.ActualAmount</td>
                        <td>@item.TaskBackAmount</td>
                        <td>@item.UsePrePayment</td>
                        <td>@item.PreferentialAmount</td>
                        <td>@item.DiscountRate</td>
                    </tr>
                }
                <tr class="footer">
                    <td>合计</td>
                    <td colspan="8"></td>
                    <td>@SumWholeAmount</td>
                    <td>@SumActualAmount</td>
                    <td>@SumTaskBackAmount</td>
                    <td>@SumUsePrePayment</td>
                    <td>@SumPreferentialAmount</td>
                    <td>@((Convert.ToDouble(SumPreferentialAmount) / Convert.ToDouble(SumActualAmount)).ToString("0.00%"))</td>
                </tr>
            }
        </tbody>
    </table>
</div>
<div class="row pagedinfo">
    <div class="col-sm-5">
        共 @Model.TotalItemCount 条，
        <select class="form-control" id="pageSize" style="width:70px;display:initial">
            @for (int z = 10; z < 100; z = z + 10)
            {
                if (z == Model.PageSize)
                {
                    <option selected value="@z">@z</option>
                }
                else
                {
                    <option value="@z">@z</option>
                }
            }
        </select> &nbsp; 条/页 当前第 @Model.PageNumber/@Model.PageCount 页
    </div>
    <div class="col-sm-7">
        <input type="hidden" id="pageurl" value="&ReceiptInfoNumber=@(Context.Request.Query["ReceiptInfoNumber"])&AgentPeoperUserId=@(Context.Request.Query["AgentPeoperUserId"])&ReceiptBeginTime=@(Context.Request.Query["ReceiptBeginTime"])&ReceiptEndTime=@(Context.Request.Query["ReceiptEndTime"])&RestaurantName=@(Context.Request.Query["RestaurantName"])&PaymentPerson=@(Context.Request.Query["PaymentPerson"])&PaymentBeginTime=@(Context.Request.Query["PaymentBeginTime"])&PaymentEndTime=@(Context.Request.Query["PaymentEndTime"])&ReceiptInfoStatus=@(Context.Request.Query["ReceiptInfoStatus"])" />
        @Html.PagedListPager(Model, page => Url.Action("Index", new { pageIdx = page, size = Context.Request.Query["size"], ReceiptInfoNumber = Context.Request.Query["ReceiptInfoNumber"], AgentPeoperUserId = Context.Request.Query["AgentPeoperUserId"], ReceiptBeginTime = Context.Request.Query["ReceiptBeginTime"], ReceiptEndTime = Context.Request.Query["ReceiptEndTime"], RestaurantName = Context.Request.Query["RestaurantName"], PaymentPerson = Context.Request.Query["PaymentPerson"], PaymentBeginTime = Context.Request.Query["PaymentBeginTime"], PaymentEndTime = Context.Request.Query["PaymentEndTime"], ReceiptInfoStatus = Context.Request.Query["ReceiptInfoStatus"] }), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new AjaxOptions() { AllowCache = false, HttpMethod = "Get", UpdateTargetId = "data_list", OnSuccess = "AjaxSuccessCallback", OnBegin = "AjaxBegin" }))
    </div>
</div>


